<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>${systemName}</title>
    <meta name="description" content="${systemName}">
    <meta name="author" content="stylefeng">

    <link rel="stylesheet" href="${ctxPath}/assets/common/layui/css/layui.css"/>
    <link href="${ctxPath}/assets/expand/plugins/ztree/zTreeStyle.css" rel="stylesheet" type="text/css"/>
    <style>
        .layui-elem-quote{
            background-color: #f7fb0b52;
            color: red;
        }
    </style>
</head>

<body>
<div class="layui-container">
    <div class="layui-form model-form" style="max-width: 700px;margin-top: 20px;">
        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red;">*</span>年份</label>
            <div class="layui-input-block">
                <select name="year" id="year" lay-filter="year">
                    @for(item in yearList){
                    <option value="${item}">${item}年</option>
                    @}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red;">*</span>月份</label>
            <div class="layui-input-block">
                <input lay-skin="primary" type="checkbox" name="months" value="1"/> 一月
                <input lay-skin="primary" type="checkbox" name="months" value="2"/> 二月
                <input lay-skin="primary" type="checkbox" name="months" value="3"/> 三月
                <input lay-skin="primary" type="checkbox" name="months" value="4"/> 四月
                <input lay-skin="primary" type="checkbox" name="months" value="5"/> 五月
                <input lay-skin="primary" type="checkbox" name="months" value="6"/> 六月
                <input lay-skin="primary" type="checkbox" name="months" value="7"/> 七月
                <input lay-skin="primary" type="checkbox" name="months" value="8"/> 八月
                <input lay-skin="primary" type="checkbox" name="months" value="9"/> 九月
                <input lay-skin="primary" type="checkbox" name="months" value="10"/> 十月
                <input lay-skin="primary" type="checkbox" name="months" value="11"/> 十一月
                <input lay-skin="primary" type="checkbox" name="months" value="12"/> 十二月
            </div>
            <blockquote class="layui-elem-quote layui-quote-nm">不选月份默认为全年 </blockquote>
        </div>

        <div class="layui-form-item text-right">
            <button class="layui-btn" id="exportBtn">导出</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog" id="backupPage">返回</button>
        </div>
    </div>
</div>

@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "",
        addCtx: function (ctx) {
            if (this.ctxPath === "") {
                this.ctxPath = ctx;
            }
        }
    };
    Feng.addCtx("${ctxPath}");
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/layui/layui.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js"></script>

<!--其他插件js-->
<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/ztree/jquery.ztree.all.min.js"></script>


<script>
    layui.use(['ax','admin','form','upload'], function () {
        var $ = layui.$;
        var $ax = layui.ax;
        var admin = layui.admin;
        var form = layui.form;
        var upload = layui.upload;

        // 让当前iframe弹层高度适应
        admin.iframeAuto();

        $("#exportBtn").click(function () {
            var year = $("#year").val();
            if(year==null || year=='' || year==undefined){
                Feng.error("请选择年度")
                return;
            }
            var months = [];
            $("input[name='months']:checked").each(function () {
                months.push($(this).val())
            })

            var operation = function () {
                var ajax = new $ax(Feng.ctxPath + "/deal/export", function () {
                    Feng.success("正在导出，请注意左下角进度")
                    admin.closeThisDialog();
                    //window.location.href = Feng.ctxPath + "/deal/export?year="+year + "&months="+months.toString()
                    window.location.href = Feng.ctxPath + "/files/files.zip"
                }, function (data) {
                    Feng.error("导出失败!" + data.responseJSON.message + "!");
                });
                ajax.set("year", year);
                ajax.set("months", months.toString());
                ajax.start();
            };
            Feng.confirm("是否导出" + months.toString() + "月的任务?", operation);

        })

    })
</script>

</body>

</html>

